package com.ynu.yx.chatroleai.model;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("users")
public class User {
    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField(value = "uid")
    private Long uid;

    @TableField(value = "username")
    private String username;

    @TableField(value = "email")
    private String email;

    @TableField(value = "password_hash")
    private String passwordHash;

    @TableField(value = "avatar_url")
    private String avatarUrl; // 用户或AI角色的头像图片的网络地址

    @TableField(value = "role")
    private String role; //  用户角色

    @TableField(value = "is_role_reviewed")
    private Integer isRoleReviewed;

    @TableField(fill = FieldFill.INSERT, value = "created_at")
    private LocalDateTime createdAt;

    @TableField(fill = FieldFill.INSERT_UPDATE, value = "updated_at")
    private LocalDateTime updatedAt;

    @TableField(value = "last_login_at")
    private LocalDateTime lastLoginAt;

    @TableField(value = "updated_username_at")
    private LocalDateTime updatedUserNameAt;

    @TableField(value = "is_active")
    private Boolean isActive;

    @TableLogic
    @TableField(value = "is_deleted")
    private Integer isDeleted;

    // 非数据库字段，用于业务逻辑
    @TableField(exist = false)
    private List<Conversation> conversations;

    @TableField(exist = false)
    private List<UserPreference> preferences;
}
